﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using ListenMusic.Comment_ServiceReference;
namespace ListenMusic.Models.Reposistory.Public
{
    public class CommentReposistory
    {
        CommentServiceClient clientComment = new CommentServiceClient();
        public List<CommentMemberSong> getAllCommentBy_SongID(int start,int end,int songID)
        {
            try
            {
                CommentMemberSong[] comment = clientComment.getAllCommentBy_SongID(songID);
                return comment.Skip(start).Take(end).ToList();
            }
            catch (FaultException ex)
            {
                throw ex;
            }

        }
        public int totalCommentby_SongID(int songid)
        { 
           try
            {
                CommentMemberSong[] comment = clientComment.getAllCommentBy_SongID(songid);
                return comment.Count();
            }
            catch (FaultException ex)
            {
                throw ex;
            } 
        }
        public List<CommentMemberAlbum> getAllCommentBy_AlbumID(int start, int end,int AlbumID)
        {
            try
            {
                CommentMemberAlbum[] comment = clientComment.getAllCommentBy_AlbumID(AlbumID);
                return comment.Skip(start).Take(end).ToList();
            }
            catch (FaultException ex)
            {
                throw ex;
            }
        }
        public int totalCommentBy_AlbumID(int albumid)
        {
            try
            {
                CommentMemberAlbum[] comment = clientComment.getAllCommentBy_AlbumID(albumid);
                return comment.Count();
            }
            catch (FaultException ex)
            {
                throw ex;
            }
        }
    }
}